package com.google.gwt.sample.dynatablerf.server;

import com.google.gwt.sample.dynatablerf.server.business.ControladorCategoria;
import com.google.gwt.sample.dynatablerf.server.domain.Categoria;

public class CategoriaLocator extends AbstractEntityLocator<Categoria, Long> {

	private ControladorCategoria controller;

	public CategoriaLocator() {

		super();
		this.controller = getContext().getBean(ControladorCategoria.class);
	}

	@Override
	public Categoria create(Class<? extends Categoria> clazz) {
		return new Categoria();
	}

	@Override
	public Categoria find(Class<? extends Categoria> clazz, Long id) {
		return controller.findById(id);
	}

	@Override
	public Class<Categoria> getDomainType() {
		return Categoria.class;
	}

	@Override
	public Long getId(Categoria domainObject) {
		return domainObject.getId();
	}

	@Override
	public Class<Long> getIdType() {
		return Long.class;
	}

	@Override
	public Object getVersion(Categoria domainObject) {
		return domainObject.getVersion();
	}

}
